var vm = new Vue({
    el: "#register",
    data: {
        userID: "",
        psw: "",
        againpsw:""
    },
    methods:{
       
        verify: function () {
            if (this.userID.length < 4) {
                if (this.userID.length == 0) {
                    alert("请输入用户名!");
                }
                else {
                    alert("用户名不小于4位！请重新输入!");
                }

            }
            else if (this.psw.length > 18 || this.psw.length < 4) {
                if (this.psw.length == 0) {
                    alert("请输入密码!");
                }
                else {
                    alert("密码要介于6-18位之间!");
                }
            }
            else if (this.againpsw != this.psw) {
                alert("第一次输入的密码与第二次的输入不相同");
            }
            else {
                axios.get('http://localhost:8080/s2/jdbcRegister?userid=' + this.userID + '&password=' + this.psw)
                    .then(function (response) {
                        if (response.data === "注册成功") {
                            alert("注册成功!");
                            window.location.replace("index.html");
                        }
                        // handle success
                        console.log(response);
                    })
                    .catch(function (error) {
                        // handle error
                        console.log(error);
                    })
                    .then(function () {
                        // always executed
                    });
                // alert("验证码正确！");
            }

        }
    }
})